#define _CRT_SECURE_NO_WARNINGS 1
#include"Sq.h"
void SLInite(SL* pst) {
	assert(pst);
	pst->a = NULL;
	pst->capacity = pst->top = 0;




}
void SLDestroy(SL* pst) {

	assert(pst);
	free(pst->a);
	pst->a = NULL;
	pst->capacity = pst->top = 0;



}
void SLPush(SL* pst, SLTypeDate x) {

	if (pst->top==pst->capacity) {

		int newdate = pst->capacity==0?4:pst->capacity*2;
		SLTypeDate* tem = (SLTypeDate*)realloc(pst->a, sizeof(SLTypeDate) * newdate);
		if (tem == NULL) {


			perror("fail");
			return;
		}
		pst->a = tem;
		pst->capacity = newdate;


	}

	pst->a[pst->top] = x;
	pst->top++;

}
void SLPop(SL* pst) {

	assert(pst);
	pst->top--;

}
SLTypeDate SLTop(SL* pst) {
	
	assert(pst);

		return pst->a[pst->top-1];
	

	

}
 bool SLEmpty(SL* pst) {

	 assert(pst);
	 return pst->top == 0;

}
int  SLSize(SL* pst) {
	assert(pst);
	return pst->top;

}